# from random import random, randint
#
# dictionary='abcdefghijklmnopqrstuvwxyz'
# li = list()
# for i in range(10):
#     num1 = randint(0, len(dictionary) - 1)
#     num2 = randint(0, len(dictionary) - 1)
#     while(num2 == num1):
#         num2 = randint(0, len(dictionary) - 1)
#     s = dictionary[num1] + dictionary[num2]
#     li.append(s)
#
from random import sample

dictionary='abcdefghijklmnopqrstuvwxyz'
li = [''.join(sample(dictionary, 2)) for _ in range(10)]

ans = {}
for i in li:
    if i in ans :
        ans[i] += 1
    else:
        ans[i] = 1
print(ans.items())
print(sorted(ans.items(), key = lambda x: x[0], reverse=True))

